namespace IAM.Interface.DAL.Request
{
    using IAM.Interface.Common.Context;
    using IAM.Interface.DAL.Request.Interface;
    using IAM.Interface.IDAL;
    using IAM.Interface.Model;
    using IAM.Interface.Model.ENUM;
    using System;

    public class IdentityMgnt : AbsTransmissionParameter, IIdentityMgnt
    {
        public virtual AccountInfo CreateIdentity(Identity identity)
        {
            RequestContextModel rcm = new RequestContextModel(ActionType.IDEN_MANAGE, OperationType.Create, identity, identity.GetType(), this.TranPar);
            RequestContextControl rcc = new RequestContextControl(rcm);
            string strreturn = rcc.Send();
            return (AccountInfo) rcc.Incept(strreturn);
        }

        public virtual AccountInfo DeleteIdentity(Identity identity)
        {
            RequestContextModel rcm = new RequestContextModel(ActionType.IDEN_MANAGE, OperationType.Delete, identity, identity.GetType(), this.TranPar);
            RequestContextControl rcc = new RequestContextControl(rcm);
            string strreturn = rcc.Send();
            return (AccountInfo) rcc.Incept(strreturn);
        }

        public virtual AccountInfo DisableIdentity(Identity identity)
        {
            RequestContextModel rcm = new RequestContextModel(ActionType.IDEN_MANAGE, OperationType.Disable, identity, identity.GetType(), this.TranPar);
            RequestContextControl rcc = new RequestContextControl(rcm);
            string strreturn = rcc.Send();
            return (AccountInfo) rcc.Incept(strreturn);
        }

        public virtual AccountInfo EnableIdentity(Identity identity)
        {
            RequestContextModel rcm = new RequestContextModel(ActionType.IDEN_MANAGE, OperationType.Enable, identity, identity.GetType(), this.TranPar);
            RequestContextControl rcc = new RequestContextControl(rcm);
            string strreturn = rcc.Send();
            return (AccountInfo) rcc.Incept(strreturn);
        }

        public virtual AccountInfo UpdateIdentity(Identity identity)
        {
            RequestContextModel rcm = new RequestContextModel(ActionType.IDEN_MANAGE, OperationType.Update, identity, identity.GetType(), this.TranPar);
            RequestContextControl rcc = new RequestContextControl(rcm);
            string strreturn = rcc.Send();
            return (AccountInfo) rcc.Incept(strreturn);
        }
    }
}
